import { GCellRenderer } from "../../../../../com/mui/controls/GCellRenderer";
import { TPetManual } from "../../../../../Message/Db/Tables/TPetManual";
import { SkillConfig } from "../../../resource/SkillConfig";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { ImagesConst } from "../../../resource/ImagesConst";
import { Language } from "../../../../../extend/language/Language";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { ObjCreate } from "../../common/ObjCreate";
import { TSkillItem } from "../skill/TSkillItem";
import { GTextFormat } from "../../../../common/GTextFormat";
import { FontUtil } from "../../../../common/font/FontUtil";
import { GlobalStyle } from "../../../../common/global/GlobalStyle";
import { TSkill } from "../../../../../Message/Db/Tables/TSkill";
//class PetIlluSkillRenderer
    
    export  class PetIlluSkillRenderer extends GCellRenderer
    {
        constructor()
        {
            super();
            this.init();
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            super.data = arg1;
            this._petManual = arg1 as TPetManual;
            if (this._petManual) 
            {
                this._nameTxt.text = this._petManual.name;
                this._infoTxt.htmlText = "<textFormat leading=\'2\'>" + this._petManual.info + "</textFormat>";
                this._tskill1 = SkillConfig.instance.getInfoByName(this._petManual.propertyOne);
                this._tskill2 = SkillConfig.instance.getInfoByName(this._petManual.propertyTwo);
                this._tskill3 = SkillConfig.instance.getInfoByName(this._petManual.propertyThree);
                this._tskill4 = SkillConfig.instance.getInfoByName(this._petManual.propertyFour);
                if (this._tskill1) 
                {
                    this._skillB1.bitmapData = GlobalClass.getBitmapData(ImagesConst.PackItemBg);
                    this._skillB1.width = 68;
                    this._skillB1.height = 68;
                }
                else 
                {
                    this._skillB1.bitmapData = GlobalClass.getBitmapData(ImagesConst.NotEnable);
                }
                if (this._tskill2) 
                {
                    this._skillB2.bitmapData = GlobalClass.getBitmapData(ImagesConst.PackItemBg);
                    this._skillB2.width = 68;
                    this._skillB2.height = 68;
                }
                else 
                {
                    this._skillB2.bitmapData = GlobalClass.getBitmapData(ImagesConst.NotEnable);
                }
                if (this._tskill3) 
                {
                    this._skillB3.bitmapData = GlobalClass.getBitmapData(ImagesConst.PackItemBg);
                    this._skillB3.width = 68;
                    this._skillB3.height = 68;
                }
                else 
                {
                    this._skillB3.bitmapData = GlobalClass.getBitmapData(ImagesConst.NotEnable);
                }
                if (this._tskill4) 
                {
                    this._skillB4.bitmapData = GlobalClass.getBitmapData(ImagesConst.PackItemBg);
                    this._skillB4.width = 68;
                    this._skillB4.height = 68;
                }
                else 
                {
                    this._skillB4.bitmapData = GlobalClass.getBitmapData(ImagesConst.NotEnable);
                }
                this._skillItem1.skill = this._tskill1;
                this._skillItem2.skill = this._tskill2;
                this._skillItem3.skill = this._tskill3;
                this._skillItem4.skill = this._tskill4;
                if (this._tskill3) 
                {
                    if (this._tskill3.posType != 0) 
                    {
                        if (this._tskill3.posType == 1) 
                        {
                            this._typeTxt.text = Language.getString(54088);
                        }
                    }
                    else 
                    {
                        this._typeTxt.text = Language.getString(54087);
                    }
                    this._useTypeTxt.text = GameDefConfig.instance.getSkillUseType(this._tskill3.useType).name;
                    this._useDistanceTxt.text = this._tskill3.attackDistance.toString();
                    this._cdTimeTxt.text = this._tskill3.cooldownTime / 1000 + Language.getString(54089);
                }
            }
            return;
        }

        /* internal  */init(): void
        {
            ObjCreate.createBg(0, 0, 500, 145, this);
            var loc1=320;
            var loc2=395;
            var loc3=50;
            ObjCreate.createBg(110, 20, 190, 25, this, ImagesConst.TileBg);
            this._skillB1 = ObjCreate.createBg(20, 60, 68, 68, this, ImagesConst.PackItemBg);
            this._skillItem1 = new TSkillItem();
            this._skillItem1.setSize(60, 60);
            this._skillItem1.move(24, 64);
            this.addChild(this._skillItem1);
            this._skillB2 = ObjCreate.createBg(93, 60, 68, 68, this, ImagesConst.PackItemBg);
            this._skillItem2 = new TSkillItem();
            this._skillItem2.setSize(60, 60);
            this._skillItem2.move(97, 64);
            this.addChild(this._skillItem2);
            this._skillB3 = ObjCreate.createBg(166, 60, 68, 68, this, ImagesConst.PackItemBg);
            this._skillItem3 = new TSkillItem();
            this._skillItem3.setSize(60, 60);
            this._skillItem3.move(170, 64);
            this.addChild(this._skillItem3);
            this._skillB4 = ObjCreate.createBg(239, 60, 68, 68, this, ImagesConst.PackItemBg);
            this._skillItem4 = new TSkillItem();
            this._skillItem4.setSize(60, 60);
            this._skillItem4.move(243, 64);
            this.addChild(this._skillItem4);
            this._infoTxt = ObjCreate.createTextField("", 155, 18, 145, 55, this, new GTextFormat(FontUtil.songtiName, 12, 65280));
            this._infoTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._infoTxt.multiline = true;
            this._infoTxt.wordWrap = true;
            this._nameTxt = ObjCreate.createTextField("", 20, 15, 115, 50, this, new GTextFormat(FontUtil.songtiName, 20, 15788607, true));
            this._nameTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            ObjCreate.createTextField(Language.getString(54090), loc1, loc3, 115, 20, this);
            this._typeTxt = ObjCreate.createTextField("", loc2, loc3, 115, 20, this, GlobalStyle.textFormat2);
            this._typeTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            loc3 = loc3 + 20;
            ObjCreate.createBg(loc1, loc3 - 2, 210, 2, this, ImagesConst.SplitLine);
            ObjCreate.createTextField(Language.getString(54091), loc1, loc3, 115, 20, this);
            this._useTypeTxt = ObjCreate.createTextField("", loc2, loc3, 115, 20, this, GlobalStyle.textFormat2);
            this._useTypeTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            loc3 = loc3 + 20;
            ObjCreate.createBg(loc1, loc3 - 2, 210, 2, this, ImagesConst.SplitLine);
            ObjCreate.createTextField(Language.getString(54092), loc1, loc3, 115, 20, this);
            this._useDistanceTxt = ObjCreate.createTextField("", loc2, loc3, 115, 20, this, GlobalStyle.textFormat2);
            this._useDistanceTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            loc3 = loc3 + 20;
            ObjCreate.createBg(loc1, loc3 - 2, 210, 2, this, ImagesConst.SplitLine);
            ObjCreate.createTextField(Language.getString(54093), loc1, loc3, 115, 20, this);
            this._cdTimeTxt = ObjCreate.createTextField("", loc2, loc3, 145, 55, this, GlobalStyle.textFormat2);
            this._cdTimeTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            return;
        }

        /* internal */ /* var */_modelBg: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_nameTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_infoTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_typeTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_useTypeTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_useDistanceTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_cdTimeTxt: Object /* flash.text.TextField */;

        /* internal */ /* var */_skillB1: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_skillB2: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_skillB3: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_skillB4: Object /* flash.display.Bitmap */;

        /* internal */ /* var */_skillItem1: TSkillItem;

        /* internal */ /* var */_skillItem2: TSkillItem;

        /* internal */ /* var */_skillItem3: TSkillItem;

        /* internal */ /* var */_skillItem4: TSkillItem;

        /* internal */ /* var */_petManual: TPetManual;

        /* internal */ /* var */_tskill1: TSkill;

        /* internal */ /* var */_tskill2: TSkill;

        /* internal */ /* var */_tskill3: TSkill;

        /* internal */ /* var */_tskill4: TSkill;
    }
